package jihe;

import java.util.ArrayList;
import java.util.List;

public class ArrayList1 {
    public static void main(String[] args)
    {
        Product pd1=new Product(4,"木糖醇",10);
        Product pd2=new Product(5,"洗发水",12);
        Product pd3=new Product(3,"热水壶",49);
        List list=new ArrayList();    //创建集合
        list.add(pd1);
        list.add(pd2);
        list.add(pd3);
        System.out.println("*************** 商品信息 ***************");
        for(int i=0;i<list.size();i++)
        {
            //循环遍历集合，输出集合元素
            Product product=(Product)list.get(i);
            System.out.println(product);
        }
    }
}
